<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<title>报单记录</title>
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/common.css" >
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/baodan-record.css" >
<script type="text/javascript" src="<?php echo $_BASE_DIR ?>baodan/js/jquery-3.1.1.min.js"></script>
		<script src="<?php echo $_BASE_DIR?>point/js/arttemplate.js"></script>
</head>

<body>
<header class="header">
    <a class="back" href="javascript:history.back(-1)"></a>
	<div class="title">报单记录</div>
</header>
<div style="height:40px;"></div>

<ul class="my-team-list">
<?php if(isset($log) && count($log)){
foreach ($log as $v){
    ?>
	<li>
		<div class="member-info clearfix"><p><?php echo $v['bd_realname']?>（<?php echo $v['bd_acctname']?>）</p><p></p></div>
		<div class="team-member">报单时间：<?php echo date('Y-m-d H:i:s',$v['created'])?></div>
	</li>
<?php
}
}else{?>
		<div style="text-align:center;margin-top:45%; color:#666; font-size:15px;">
		    <img src="/point/img/sad_emoji_icon.png"  width="30" height="30" style="margin:0 auto 10px;"/>
		    <p>你还没有报单记录哦！</p>
		</div>
		<?php }?>
</ul>


   <style>
        .alertmsg{
                filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5;
                width:200px;height:30px;margin:10px auto;
                border-radius:20px;
                display:none;
              
            }
        
        .alertmsg span{
                color:white;font-size:15px;
                line-height:30px;
                padding:5px 20px;
                background:rgba(0,0,0,0.5);
                border-radius:50px;
        }
    </style>
    
    <div class="alertmsg">
        <center><span class="msg"></span></center>
    </div>
    
    
<script type="text/html" id="listmore">
	{{each data as value i}}
	<li>
		<div class="member-info clearfix"><p>{{value.bd_realname}}（{{value.bd_acctname}}）</p><p>{{value.level}}代</p></div>
		<div class="team-member">报单时间：{{value.createtime}}</div>
	</li>
	{{/each}}
</script>

<script>
function msghide(){
	$('.alertmsg').hide();
}
$(function() {
     var  tag = 1;
    var winH = $(window).height(); //页面可视区域高度  

    $(window).scroll(function() {
      
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());     //浏览器的高度加上滚动条的高度 
        
		if ($(document).height() <= totalheight)    //当文档的高度小于或者等于总的高度的时候，开始动态加载数据
        { 	
        	var last = $('.my-team-list li').length;
        	if(tag == 1){
              tag = 0;
            //这里要加载数据
        	$.ajax({
                type : 'POST',
                url : '/my/bdlog',
                data : {last : last},
                dataType : "json",
                timeout : 2000,
                success : function (res) {
                    if(res.status == 0){
                        if(res.data){
                            if(tag == 0){
                            	var html = template('listmore', res);
                            	tag = 1;
         						$('.my-team-list').append(html);
                            }
                     	} else {
                            $('.msg').html(res.msg);
							$('.alertmsg').show();
							tag = 1;
							setTimeout("msghide()", 2000);
                        }
                     }
                },
                error : function () {
                  tag = 1;
                },
           });
        } 
    } 
    });
});
</script>

</body>
</html>
